﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace KPIS.GERP.GIMS.APP.APP_UI.UserControl
{
    public partial class TIP_DurationList : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                LoadGrid();
            }
        }

        protected void LoadGrid()
        {
            IList<string> DurationList = new List<string>();
            DurationList = (List<string>)Session["ListDuration"];
            DataTable dt = new DataTable();
            dt.Columns.Add("Seq", typeof(int));
            dt.Columns.Add("Duration", typeof(string));

            if (DurationList.Count > 0)
            {
                int i = 1;
                foreach (string cur in DurationList)
                {
                    dt.Rows.Add(i, cur);
                    i++;
                }
            }

            GridList.DataSource = dt;
            GridList.DataBind();
        }

        protected void GridList_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            LoadGrid();
        }
    }
}